function dateTimeChange(dateId,timeId,dateTimeId){
		var date = $("#"+dateId).val();
		var time = $("#"+timeId).val();
		if(date && time ){
		    $("#"+dateTimeId).val(date + " " + time);
		}
		return true;
}

function initDate(){
    $(".date-picker").datepicker({autoclose:true,language: 'cn',  format: 'yyyy-mm-dd'});
    $(".time-picker").timepicker({
                minuteStep: 1,
                showSeconds: true,
                showMeridian: false
   });
}

function changeRsmStatus(srcObject,targetId){
    var targetVal = $(srcObject).find("option:selected").attr("rel");
    if(targetVal){
        $("#"+targetId).val(targetVal);
    }
}

function inputInitCheck(){
         initDate();
         $("#name").change(function (){
 			check.checkEmpty("name");
 		});
 		$("#mobile").change(function (){
 			check.checkEmpty("mobile");
 		});
 		$("#email").change(function (){
             check.email("email");
        });
 }

 function inputSubmitCheck(){
        return  check.checkEmpty("name")
         	 	 & check.checkEmpty("mobile")
         	 	 & check.mobile("mobile")
         	 	 & check.email("email")
         	 	 & dateTimeChange("orderDate","orderDatetime","orderTime")
 }

function areaSubmit( targetId ){
        var info = $("#locationDiv").getLocation();
        var area = "";
        if(info.provinceVal == 0) {
            area ="";
        } else if(info.cityVal == 0){
            area = info.province;
        } else if(info.districtVal == 0){
            area = info.province + info.city;
        } else {
            area = info.province + info.city + info.district;
        }
        $('#' + targetId).val(area);
        common.closeGlobalMessage();
        return false;
}
function doAreaSelect(uri,targetId ){
     var areaHtml = '<div class="clearfix">'+
                        '<div id="locationDiv" class="pull-left">' +
                        '</div>'+
                        '<div class="pull-left" style="margin-left:20px">' +
                            '<input type="button" class="btn-xs btn-success" value="确定" onclick="areaSubmit(\'' + targetId + '\')"/>'+
                        '</div>'+
                     '</div>';
    common.modalGlobalMessage(areaHtml,'地区选择');
    $("#locationDiv").LocationSelect({"data":uri});
}
